<template>
  <ModalDialog v-model:visible="isShowDia" secClass="form_card_sec" title="审批管理">
    <template #content>
      <div class="form_body">
        <div class="add_box">
          <n-flex class="top_tab" justify="center">
            <a :class="`pointer ${tabType === item.value && 'active'}`" @click="setTabAc(item.value)"
               v-for="(item ,index) in tabArr" :key="index">{{t(item.label)}}
            </a>
          </n-flex>
          <div class="sea_admin_box">
            <n-flex class="sea_top" justify="space-between" align="center">
              <div class="input_box"><n-input v-model:value="seaName" :placeholder="t('搜索成员')" clearable :bordered="false" /></div>
              <a class="button button_color">搜索</a>
            </n-flex>
            <div class="admin_list_box">
              <n-flex class="admin_listItem_box" justify="space-between" align="center">
                <n-flex class="ad_list_l">
                  <Imgt src="/img/club/new/image.webp"/>
                  <div>
                    <div>svir001 管理员</div>
                    <span class="vip_box">VIP1</span>
                  </div>
                </n-flex>
                <n-flex class="ad_list_r">
                  <a class="button" @click="setAdminAc('pass')">{{t('通过')}}</a>
                  <a class="button" @click="setAdminAc('cancel')">{{t('拒绝')}}</a>
                </n-flex>
              </n-flex>
              <n-flex class="admin_listItem_box" justify="space-between" align="center">
                <n-flex class="ad_list_l">
                  <Imgt src="/img/club/new/image.webp"/>
                  <div>
                    <div>svir001</div>
                    <span class="vip_box">VIP1</span>
                  </div>
                </n-flex>
                <n-flex class="ad_list_r">
                  <a class="button" @click="setAdminAc('pass')">{{t('通过')}}</a>
                  <a class="button" @click="setAdminAc('cancel')">{{t('拒绝')}}</a>
                </n-flex>
              </n-flex>
            </div>
          </div>

        </div>
      </div>
    </template>
  </ModalDialog>
  <!-- 取消和设置管理员 -->
  <ModalDialog v-model:visible="isTipsDia" secClass="form_card_sec" title="提示">
    <template #content>
      <div class="tip_form_body">
        <div class="tips_title"> {{setTxt}} </div>
        <n-flex class="tips_btn" justify="center">
          <a class=" button" @click="isTipsDia = false">取消</a>
          <a class="button_color button">确定</a>
        </n-flex>
      </div>
    </template>
  </ModalDialog>
</template>

<script setup lang="ts">
import { computed, ref } from "vue";
import Imgt from "@/components/Imgt.vue";
import { useI18n } from "vue-i18n";
import ModalDialog from '@/components/ModalDialog.vue';

const { t } = useI18n();
const props = defineProps({
  visible: {
    type: Boolean,
    default: false,
  },
});
const emit = defineEmits(["update:visible"]);

const isTipsDia = ref(false);
const acType = ref('cancel'); // cancel, pass
const setTxt = ref();
const seaName = ref();
const tabType = ref(1);
const tabArr = ref([
  {label: '未处理', value: 1},
  {label: '已处理', value: 2},
]);

const isShowDia = computed({
  get: function () {
    return props.visible;
  },
  set: function (value) {
    emit("update:visible", value);
  },
});
const setTabAc = (val: any) => {
  tabType.value = val
}
const setAdminAc = (type: any) => {
  isTipsDia.value = true;
  acType.value = type;
  setTxt.value = type === 'cancel' ? `是否拒绝该成员的加入？` : `是否通过该成员的加入？`;
}

</script>
<style lang="less" scoped>
@import '@/assets/club.less';
.form_body {
  padding: 20px 12px !important;
  font-size: 16px;
  .top_tab {
    margin-bottom: 16px;
    gap: 40px !important;
    height: 40px;
    a {
      position: relative;
      text-align: center;
    }
    .active {
      background-image: linear-gradient(0deg, #B5A4FF, #B5A4FF);
      color: #9E1EFF; // 兜底颜色，防止文字裁剪不生效
      background-clip: text;
      -webkit-background-clip: text; // 背景被裁减为文字的前景色
      -webkit-text-fill-color: transparent; // 文字填充为透明，优先级比color高。

      &::after {
        content: '';
        position: absolute;
        width: 36px;
        height: 7px;
        background: linear-gradient(180deg, #5A6CFF 0%, #7E1CFF 100%);
        border-radius: 100px;
        bottom: 0;
        left: 50%;
        margin-left: -18px;
      }
    }
  }
  .admin_list_box {
    max-height: 260px;
    overflow-y: auto;
    .admin_listItem_box {
      background: #212443;
      border-radius: 8px;
      margin-bottom: 12px;
      padding: 14px 20px;
      .ad_list_l {
        gap: 4px !important;
        img {
          width: 52px;
          height: 52px;
          border-radius: 50%;
        }
        .vip_box {
          display: inline-block;
          text-align: center;
          font-size: 12px;
          width: 50px;
          height: 20px;
          line-height: 20px;
          background: #373A5F;
          color: #AFB6BD;
          border-radius: 4px;
        }

      }
      .ad_list_r {
        gap: 12px !important;
        a {
          display: flex;
          justify-content: center;
          align-items: center;
          background: linear-gradient(180deg, #1FD652 0%, #0B7B32 100%);
          border-radius: 8px;
          width: 80px;
          height: 40px;
          line-height: 18px;
          text-align: center;
          &:last-child {
            background: linear-gradient(180deg, #F95959 0%, #E11313 100%);
          }
        }
      }
    }
  }
  .sea_admin_box {
    .sea_top {
      gap: 12px !important;
      margin-bottom: 16px;
      .input_box {
        flex: 1;
        :deep(.n-input) {
          background: #0D0D29;
          border-radius: 8px;
          .n-input__input-el {
            height: 40px;
          }
        }
      }
      a {
        width: 80px;
        height: 40px;
        line-height: 40px;
        text-align: center;
      }
    }
  }

}
</style>
